
/**
 * Write a description of class Persoonpaneel here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;


public class Supermarktpaneel  {
    private Manager manager;
    private Manager ingelezenManager;
    

    public Supermarktpaneel(){

    }

    public void save(Manager manager){
        try {
            ObjectOutputStream uit =
                new ObjectOutputStream(
                    new FileOutputStream( "supermarkt.dat" )
                    );
                    uit.writeObject ( manager );
                    uit.close();
            }
            catch ( IOException e ) {
                System.out.println( "IO-exceptie" );
        }
    }

    public Manager leesUit(){        
        try{ 
            ObjectInputStream in = 
                new ObjectInputStream(
                    new FileInputStream( "supermarkt.dat" )
                    );
                    
                        ingelezenManager = (Manager) in.readObject();
                    
                    in.close();
                } 
                catch (ClassNotFoundException e ){
                    System.out.println ( "IO-exceptie" );
                }
              
        catch (IOException e) {
            String naam = TuiHelper.stelVraagMetTekstAntwoord( "Vul hier uw naam in: " );
            String wachtwoord = TuiHelper.stelVraagMetTekstAntwoord( "\nVul het wachtwoord in: " );
            String supermarkt = TuiHelper.stelVraagMetTekstAntwoord( "\nVul hier de supermarkt naam in: " );
            double geld = TuiHelper.stelVraagMetDoubleAntwoord("\nHoeveel geld heeft u?","", 0.0, 1000000.0);
            ingelezenManager = new Manager( naam, wachtwoord, supermarkt, geld );
        }
        return ingelezenManager;
    }
    
    
 
 
}
     


